<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>移交管理</title>
<#include "../common/link.ftl"/>

    <script>
        $(function () {
            //编辑
            $(".btn-input").click(function () {
                var json = $(this).data("json");
                if(json){
                    $("input[name=id]").val(json.id);
                    $('input[name=name]').val(json.customerId);
                    $("input[name='oldSeller.id']").val(json.oldsellerId);
                    $("input[name='newSeller.id']").val(json.newsellerId);
                }
                $("#traceModal").modal("show");
            })

            $(".btn-traceSubmit").click(function () {
                $("#traceForm").ajaxSubmit(function (data) {
                    if (data.success) {
                        $.messager.alert("温馨提示", "执行成功,2s后自动刷新");
                        //2秒后自动关闭
                        setTimeout(function () {
                            //刷新本页面
                            window.location.reload();
                        }, 1600);
                        alert("恭喜你,保存成功");
                    } else {
                        $.messager.alert(data.msg);
                    }
                })
            })
        })
    </script>


</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<#include "../common/navbar.ftl"/>
    <!--菜单回显-->
<#assign currentMenu="customerTransfer"/>
<#include "../common/menu.ftl"/>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>移交管理管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/customerTransfer/list.do" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <div class="form-group">
                        <label for="keyword">关键字:</label>
                        <input type="text" class="form-control" id="keyword" name="keyword" value="${(qo.keyword)!}"
                               placeholder="请输入姓名/电话">
                    </div>

                    <button id="btn_query"  class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询
                    </button>

                </form>
                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered">
                        <tr>
                            <th>编号</th>
                            <th>客户</th>
                            <th>操作人员</th>
                            <th>操作时间</th>
                            <th>前销售人员</th>
                            <th>新销售人员</th>
                            <th>移交原因</th>
                            <th>操作</th>
                        </tr>
                    <#--list,要遍历的集合 as 变量-->
                    <#list pageResult.list as entity>
                        <tr>
                        <#--从0开始,需要加1-->
                            <td>${entity_index + 1}</td>
                            <td>${(entity.customer.name)!}</td>
                            <td>${entity.operator.name}</td>
                            <td>${entity.operateTime?string('yyyy-MM-dd')}</td>
                            <td>${entity.oldSeller.name}</td>
                            <td>${entity.newSeller.name}</td>
                            <td>${entity.reason}</td>
                            <td>
                                <a class="btn btn-info btn-xs btn-input" href="javascript:;" data-json='${entity.jsonString}' >
                                    <span class="glyphicon glyphicon-pencil"></span> 编辑
                                </a>
                            </td>
                        </tr>
                    </#list>
                    </table>
                    <!--分页-->
                <#include "../common/page.ftl"/>
                </div>
            </div>
        </section>
    </div>
<#include "../common/footer.ftl"/>
</div>


<#--移交-->
<div class="modal fade" id="traceModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">移交</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/customerTransfer/saveOrUpdate.do" method="post" id="traceForm">
                    <input type="hidden" name="id"/>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">客户姓名：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" readonly name="name"/>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">旧营销人员：</label>
                        <div class="col-lg-6 ">
                            <input type="text" class="form-control" readonly name="oldSeller.id">
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">新营销人员：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" name="newSeller.id"
                                   placeholder="请输入新营销人员"/>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">移交原因：</label>
                        <div class="col-lg-6">
                            <textarea type="text" class="form-control" name="reason"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary btn-traceSubmit">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

</body>
</html>



